From 3a5b2f54ea2d09fd9f1ed48ff90a32a77d83edc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sat, 7 Apr 2018 10:13:36 +0200 Subject: [PATCH] widget: Remove gtk_widget_get_own_allocation Use compute_bounds everywhere. --- gtk/gtkwidget.c | 35 ++++++++++++++--------------------- gtk/gtkwidgetprivate.h | 3 --- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 57590f1f2f..d9ed6d06e7 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11464,25 +11464,6 @@ gtk_widget_get_outer_allocation (GtkWidget *widget, allocation->height -= margin.top + margin.bottom; } -void -gtk_widget_get_own_allocation (GtkWidget *widget, - GdkRectangle *allocation) -{ - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - GtkBorder margin, border, padding; - GtkCssStyle *style; - - style = gtk_css_node_get_style (priv->cssnode); - get_box_margin (style, &margin); - get_box_border (style, &border); - get_box_padding (style, &padding); - - allocation->x = -padding.left - border.left; - allocation->y = -padding.top - border.top; - allocation->width = priv->allocation.width - margin.left - margin.right; - allocation->height = priv->allocation.height -margin.top - margin.bottom; -} - /** * gtk_widget_compute_bounds: * @widget: the #GtkWidget to query @@ -11506,13 +11487,25 @@ gtk_widget_compute_bounds (GtkWidget *widget, GtkWidget *target, graphene_rect_t *out_bounds) { + GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); + GtkBorder margin, border, padding; + GtkCssStyle *style; GtkAllocation alloc; g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (target), FALSE); g_return_val_if_fail (out_bounds != NULL, FALSE); - gtk_widget_get_own_allocation (widget, &alloc); + style = gtk_css_node_get_style (priv->cssnode); + get_box_margin (style, &margin); + get_box_border (style, &border); + get_box_padding (style, &padding); + + alloc.x = - (padding.left + border.left); + alloc.y = - (padding.top + border.top); + alloc.width = priv->allocation.width - margin.left - margin.right; + alloc.height = priv->allocation.height -margin.top - margin.bottom; + if (!gtk_widget_translate_coordinates (widget, target, alloc.x, alloc.y, @@ -11522,7 +11515,7 @@ gtk_widget_compute_bounds (GtkWidget *widget, return FALSE; } - graphene_rect_init (out_bounds, + graphene_rect_init (out_bounds, alloc.x, alloc.y, alloc.width, diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 971292ad38..a6be3a51d1 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -321,9 +321,6 @@ gboolean gtk_widget_focus_move (GtkWidget *wi GPtrArray *focus_order); void gtk_widget_get_outer_allocation (GtkWidget *widget, GtkAllocation *allocation); -void gtk_widget_get_own_allocation (GtkWidget *widget, - GtkAllocation *allocation); - void gtk_widget_get_surface_allocation (GtkWidget *widget, GtkAllocation *allocation); -- 2.30.2